home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / TextServices.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  12.4 KB  |  307 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        TextServices.p
  3.  
  4.      Contains:    Text Services Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 8.2
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1991-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT TextServices;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __TEXTSERVICES__}
  27. {$SETC __TEXTSERVICES__ := 1}
  28.  
  29. {$I+}
  30. {$SETC TextServicesIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __CONDITIONALMACROS__}
  34. {$I ConditionalMacros.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __MACTYPES__}
  37. {$I MacTypes.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __EVENTS__}
  40. {$I Events.p}
  41. {$ENDC}
  42. {$IFC UNDEFINED __MENUS__}
  43. {$I Menus.p}
  44. {$ENDC}
  45. {$IFC UNDEFINED __AEDATAMODEL__}
  46. {$I AEDataModel.p}
  47. {$ENDC}
  48. {$IFC UNDEFINED __AEREGISTRY__}
  49. {$I AERegistry.p}
  50. {$ENDC}
  51. {$IFC UNDEFINED __COMPONENTS__}
  52. {$I Components.p}
  53. {$ENDC}
  54.  
  55.  
  56. {$PUSH}
  57. {$ALIGN MAC68K}
  58. {$LibExport+}
  59.  
  60.  
  61. CONST
  62.     kTextService                = 'tsvc';                        {  component type for the component description  }
  63.     kInputMethodService            = 'inpm';                        {  component subtype for the component description  }
  64.     kTSMVersion                    = $0150;                        {  Version of the Text Services Manager is 1.5  }
  65.  
  66.     kUnicodeDocument            = 'udoc';                        {  TSM Document type for Unicode-savvy application  }
  67.     kUnicodeTextService            = 'utsv';                        {  Component type for Unicode Text Service  }
  68.  
  69. {  Language and Script constants }
  70.     kUnknownLanguage            = $FFFF;
  71.     kUnknownScript                = $FFFF;
  72.     kNeutralScript                = $FFFF;
  73.  
  74.  
  75.                                                                 {  Component Flags in ComponentDescription  }
  76.     bTakeActiveEvent            = 15;                            {  bit set if the component takes active event  }
  77.     bHandleAERecording            = 16;                            {  bit set if the component takes care of recording Apple Events <new in vers2.0>  }
  78.     bScriptMask                    = $00007F00;                    {  bit 8 - 14  }
  79.     bLanguageMask                = $000000FF;                    {  bit 0 - 7   }
  80.     bScriptLanguageMask            = $00007FFF;                    {  bit 0 - 14   }
  81.  
  82.                                                                 {  Typing method property constants for Input Methods  }
  83.     kIMJaTypingMethodProperty    = 'jtyp';                        {  Typing method property for Japanese input methods }
  84.     kIMJaTypingMethodRoman        = 'roma';                        {  Roman typing }
  85.     kIMJaTypingMethodKana        = 'kana';                        {  Kana typing }
  86.  
  87.                                                                 {  Low level routines which are dispatched directly to the Component Manager  }
  88.     kCMGetScriptLangSupport        = $0001;                        {  Component Manager call selector 1  }
  89.     kCMInitiateTextService        = $0002;                        {  Component Manager call selector 2  }
  90.     kCMTerminateTextService        = $0003;                        {  Component Manager call selector 3  }
  91.     kCMActivateTextService        = $0004;                        {  Component Manager call selector 4  }
  92.     kCMDeactivateTextService    = $0005;                        {  Component Manager call selector 5  }
  93.     kCMTextServiceEvent            = $0006;                        {  Component Manager call selector 6  }
  94.     kCMGetTextServiceMenu        = $0007;                        {  Component Manager call selector 7  }
  95.     kCMTextServiceMenuSelect    = $0008;                        {  Component Manager call selector 8  }
  96.     kCMFixTextService            = $0009;                        {  Component Manager call selector 9  }
  97.     kCMSetTextServiceCursor        = $000A;                        {  Component Manager call selector 10  }
  98.     kCMHidePaletteWindows        = $000B;                        {  Component Manager call selector 11  }
  99.     kCMGetTextServiceProperty    = $000C;                        {  Component Manager call selector 12  }
  100.     kCMSetTextServiceProperty    = $000D;                        {  Component Manager call selector 13  }
  101.  
  102.                                                                 {  New low level routines which are dispatched directly to the Component Manager  }
  103.     kCMUCTextServiceEvent        = $000E;                        {  Component Manager call selector 14  }
  104.  
  105.  
  106.  
  107. { New opaque definitions for types }
  108.  
  109. TYPE
  110.     TSMDocumentID = ^LONGINT;
  111.     InterfaceTypeList                    = ARRAY [0..0] OF OSType;
  112.  
  113. { Text Service Info List }
  114.     TextServiceInfoPtr = ^TextServiceInfo;
  115.     TextServiceInfo = RECORD
  116.         fComponent:                Component;
  117.         fItemName:                Str255;
  118.     END;
  119.  
  120.     TextServiceListPtr = ^TextServiceList;
  121.     TextServiceList = RECORD
  122.         fTextServiceCount:        INTEGER;                                {  number of entries in the 'fServices' array  }
  123.         fServices:                ARRAY [0..0] OF TextServiceInfo;        {  Note: array of 'TextServiceInfo' records follows  }
  124.     END;
  125.  
  126.     TextServiceListHandle                = ^TextServiceListPtr;
  127.     ScriptLanguageRecordPtr = ^ScriptLanguageRecord;
  128.     ScriptLanguageRecord = RECORD
  129.         fScript:                ScriptCode;
  130.         fLanguage:                LangCode;
  131.     END;
  132.  
  133.     ScriptLanguageSupportPtr = ^ScriptLanguageSupport;
  134.     ScriptLanguageSupport = RECORD
  135.         fScriptLanguageCount:    INTEGER;                                {  number of entries in the 'fScriptLanguageArray' array  }
  136.         fScriptLanguageArray:    ARRAY [0..0] OF ScriptLanguageRecord;    {  Note: array of 'ScriptLanguageRecord' records follows  }
  137.     END;
  138.  
  139.     ScriptLanguageSupportHandle            = ^ScriptLanguageSupportPtr;
  140. { High level TSM Doucment routines }
  141. FUNCTION NewTSMDocument(numOfInterface: INTEGER; VAR supportedInterfaceTypes: InterfaceTypeList; VAR idocID: TSMDocumentID; refcon: LONGINT): OSErr;
  142.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  143.     INLINE $7000, $AA54;
  144.     {$ENDC}
  145. FUNCTION DeleteTSMDocument(idocID: TSMDocumentID): OSErr;
  146.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  147.     INLINE $7001, $AA54;
  148.     {$ENDC}
  149. FUNCTION ActivateTSMDocument(idocID: TSMDocumentID): OSErr;
  150.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  151.     INLINE $7002, $AA54;
  152.     {$ENDC}
  153. FUNCTION DeactivateTSMDocument(idocID: TSMDocumentID): OSErr;
  154.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  155.     INLINE $7003, $AA54;
  156.     {$ENDC}
  157. FUNCTION SetTSMCursor(mousePos: Point): BOOLEAN;
  158.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  159.     INLINE $7006, $AA54;
  160.     {$ENDC}
  161. FUNCTION FixTSMDocument(idocID: TSMDocumentID): OSErr;
  162.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  163.     INLINE $7007, $AA54;
  164.     {$ENDC}
  165. { Utilities }
  166. FUNCTION UseInputWindow(idocID: TSMDocumentID; useWindow: BOOLEAN): OSErr;
  167.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  168.     INLINE $7010, $AA54;
  169.     {$ENDC}
  170. FUNCTION TSMEvent(VAR event: EventRecord): BOOLEAN;
  171.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  172.     INLINE $7004, $AA54;
  173.     {$ENDC}
  174. FUNCTION TSMMenuSelect(menuResult: LONGINT): BOOLEAN;
  175.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  176.     INLINE $7005, $AA54;
  177.     {$ENDC}
  178. FUNCTION InitTSMAwareApplication: OSErr;
  179.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  180.     INLINE $7014, $AA54;
  181.     {$ENDC}
  182. FUNCTION CloseTSMAwareApplication: OSErr;
  183.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  184.     INLINE $7015, $AA54;
  185.     {$ENDC}
  186. { Redundant Utilities }
  187. FUNCTION SendAEFromTSMComponent({CONST}VAR theAppleEvent: AppleEvent; VAR reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: LONGINT; idleProc: AEIdleUPP; filterProc: AEFilterUPP): OSErr;
  188.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  189.     INLINE $700B, $AA54;
  190.     {$ENDC}
  191. FUNCTION NewServiceWindow(wStorage: UNIV Ptr; {CONST}VAR boundsRect: Rect; title: Str255; visible: BOOLEAN; theProc: INTEGER; behind: WindowPtr; goAwayFlag: BOOLEAN; ts: ComponentInstance; VAR window: WindowPtr): OSErr;
  192.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  193.     INLINE $7011, $AA54;
  194.     {$ENDC}
  195. FUNCTION NewCServiceWindow(wStorage: UNIV Ptr; {CONST}VAR boundsRect: Rect; title: Str255; visible: BOOLEAN; theProc: INTEGER; behind: WindowPtr; goAwayFlag: BOOLEAN; ts: ComponentInstance; VAR window: WindowPtr): OSErr;
  196.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  197.     INLINE $701A, $AA54;
  198.     {$ENDC}
  199. FUNCTION CloseServiceWindow(window: WindowPtr): OSErr;
  200.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  201.     INLINE $7012, $AA54;
  202.     {$ENDC}
  203. FUNCTION GetFrontServiceWindow(VAR window: WindowPtr): OSErr;
  204.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  205.     INLINE $7013, $AA54;
  206.     {$ENDC}
  207. FUNCTION FindServiceWindow(thePoint: Point; VAR theWindow: WindowPtr): INTEGER;
  208.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  209.     INLINE $7017, $AA54;
  210.     {$ENDC}
  211. FUNCTION SetDefaultInputMethod(ts: Component; VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  212.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  213.     INLINE $700C, $AA54;
  214.     {$ENDC}
  215. FUNCTION GetDefaultInputMethod(VAR ts: Component; VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  216.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  217.     INLINE $700D, $AA54;
  218.     {$ENDC}
  219. FUNCTION SetTextServiceLanguage(VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  220.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  221.     INLINE $700E, $AA54;
  222.     {$ENDC}
  223. FUNCTION GetTextServiceLanguage(VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  224.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  225.     INLINE $700F, $AA54;
  226.     {$ENDC}
  227. { Component Manager Interfaces to Input Methods }
  228. FUNCTION GetScriptLanguageSupport(ts: ComponentInstance; VAR scriptHdl: ScriptLanguageSupportHandle): ComponentResult;
  229.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  230.     INLINE $2F3C, $0004, $0001, $7000, $A82A;
  231.     {$ENDC}
  232. FUNCTION InitiateTextService(ts: ComponentInstance): ComponentResult;
  233.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  234.     INLINE $2F3C, $0000, $0002, $7000, $A82A;
  235.     {$ENDC}
  236. FUNCTION TerminateTextService(ts: ComponentInstance): ComponentResult;
  237.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  238.     INLINE $2F3C, $0000, $0003, $7000, $A82A;
  239.     {$ENDC}
  240. FUNCTION ActivateTextService(ts: ComponentInstance): ComponentResult;
  241.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  242.     INLINE $2F3C, $0000, $0004, $7000, $A82A;
  243.     {$ENDC}
  244. FUNCTION DeactivateTextService(ts: ComponentInstance): ComponentResult;
  245.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  246.     INLINE $2F3C, $0000, $0005, $7000, $A82A;
  247.     {$ENDC}
  248. FUNCTION TextServiceEvent(ts: ComponentInstance; numOfEvents: INTEGER; VAR event: EventRecord): ComponentResult;
  249.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  250.     INLINE $2F3C, $0006, $0006, $7000, $A82A;
  251.     {$ENDC}
  252. FUNCTION UCTextServiceEvent(ts: ComponentInstance; numOfEvents: INTEGER; VAR event: EventRecord; VAR unicodeString: UniChar; unicodeStrLength: UniCharCount): ComponentResult;
  253.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  254.     INLINE $2F3C, $000E, $000E, $7000, $A82A;
  255.     {$ENDC}
  256. FUNCTION GetTextServiceMenu(ts: ComponentInstance; VAR serviceMenu: MenuHandle): ComponentResult;
  257.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  258.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  259.     {$ENDC}
  260. FUNCTION TextServiceMenuSelect(ts: ComponentInstance; serviceMenu: MenuHandle; item: INTEGER): ComponentResult;
  261.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  262.     INLINE $2F3C, $0006, $0008, $7000, $A82A;
  263.     {$ENDC}
  264. FUNCTION FixTextService(ts: ComponentInstance): ComponentResult;
  265.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  266.     INLINE $2F3C, $0000, $0009, $7000, $A82A;
  267.     {$ENDC}
  268. FUNCTION SetTextServiceCursor(ts: ComponentInstance; mousePos: Point): ComponentResult;
  269.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  270.     INLINE $2F3C, $0004, $000A, $7000, $A82A;
  271.     {$ENDC}
  272. FUNCTION HidePaletteWindows(ts: ComponentInstance): ComponentResult;
  273.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  274.     INLINE $2F3C, $0000, $000B, $7000, $A82A;
  275.     {$ENDC}
  276. FUNCTION GetServiceList(numOfInterface: INTEGER; VAR supportedInterfaceTypes: OSType; VAR serviceInfo: TextServiceListHandle; VAR seedValue: LONGINT): OSErr;
  277.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  278.     INLINE $7008, $AA54;
  279.     {$ENDC}
  280. FUNCTION OpenTextService(idocID: TSMDocumentID; aComponent: Component; VAR aComponentInstance: ComponentInstance): OSErr;
  281.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  282.     INLINE $7009, $AA54;
  283.     {$ENDC}
  284. FUNCTION CloseTextService(idocID: TSMDocumentID; aComponentInstance: ComponentInstance): OSErr;
  285.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  286.     INLINE $700A, $AA54;
  287.     {$ENDC}
  288. FUNCTION GetTextServiceProperty(ts: ComponentInstance; propertySelector: OSType; VAR result: SInt32): ComponentResult;
  289.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  290.     INLINE $2F3C, $0008, $000C, $7000, $A82A;
  291.     {$ENDC}
  292. FUNCTION SetTextServiceProperty(ts: ComponentInstance; propertySelector: OSType; value: SInt32): ComponentResult;
  293.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  294.     INLINE $2F3C, $0008, $000D, $7000, $A82A;
  295.     {$ENDC}
  296.  
  297. {$ALIGN RESET}
  298. {$POP}
  299.  
  300. {$SETC UsingIncludes := TextServicesIncludes}
  301.  
  302. {$ENDC} {__TEXTSERVICES__}
  303.  
  304. {$IFC NOT UsingIncludes}
  305.  END.
  306. {$ENDC}
  307.